from os import system

'''
学期     term
课程名   name
上课地点 address
上课周   week
上课星期 weekday
上课节   part
'''


def command(*commands):
    n = 48
    tips = "+{}+\n".format('-'.ljust(n, '-'))
    tips += '''|{}|\n'''.format(commands[0].ljust(n))
    tips += "+{}+\n".format('-'.ljust(n, '-'))
    for index in range(1, len(commands)):
        tips += "|{}|\n".format(commands[index].ljust(n))
    tips += "+{}+\n".format('-'.ljust(n, '-'))
    tips += "please input command\t"
    return tips


def save():
    global data
    tips = command("Do you really want to save data?", "1-continue", "2-cancel")
    cd = input(tips)
    system("cls")


def read():
    global data
    tips = command("Which file you want to read?", "1-continue", "2-cancel")
    cd = input(tips)
    system("cls")


def main():
    global data
    tips = command("Welcome to use the class book manage process", "1-read data", "2-save data", "3-change data")
    while True:
        cd = input(tips)
        system("cls")
        if cd == '1':
            read()
        if cd == '2':
            save()
        if cd == '3':
            change()


def change():
    global data
    tips = command("which classes you want to change", "x-the index of class", "0-break")

    while True:
        cd = input(tips)
        system("cls")
        if cd == '0':
            break
        else:
            pass


if __name__ == '__main__':
    data = {"time": "", "week": ""}
    main()
